<?php
namespace wechat\controllers;

use Yii;
use yii\base\Event;
use yii\helpers\Url;
use framework\helpers\Utils;
use common\models\UcenterMember;
use common\models\base\cms\Cat;
use common\models\base\cms\Link;
use common\models\base\fund\Product;
use frontend\actions\app\member;
use common\models\_LoginForm;
use frontend\actions\sinapay;
use common\models\base\asset\Info;
use frontend\actions\app\Invest;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;

/**
 * Site controller
 */
class InvestController extends FrontendController
{
	
    public function actionIndex()
    {
		return $this->view('index');
    }
    public function actionDoinvest(){
        $uid = Yii::$app->user->id;
        if($_POST){
            $money =$_POST['money'];
            $pid = $_POST['product_id'];
            $result = Invest::Invest($uid, $pid, $money);
            Invest::gold($uid,$money);//体验金

            if($result['errorNum'] == 1){
                return $result['errorMsg'];
            }else{
                return '您已成功完成了投资';
            }

        }
    }
}